/**
 * Created with IntelliJ IDEA.
 * User: Thoughtworker
 * Date: 7/11/13
 * Time: 9:18 AM
 * To change this template use File | Settings | File Templates.
 */
public class ReserveCommand implements Command {
    Library library;
    Menu menu;
    UserDataBase userDataBase;
    public ReserveCommand(Library library, Menu menu, UserDataBase usersDatabase) {
        this.library = library;
        this.menu = menu;
        this.userDataBase = usersDatabase;
    }

    @Override
    public void select() {
        if(userDataBase.isSomeoneLoggedIn()) library.reserveBook(menu.enterBookTitle());
        else{
            if(userDataBase.checkUserCredentials()) {
                library.reserveBook(menu.enterBookTitle());
            }
     }

    }

}
